package logic

import (
	"core/command"
	"core/component/logger"
)

func (world *World) playerIntoPvpServerHandler(msgId uint16, data []byte) {
	msgRecv := &command.PlayerIntoPvpServer{}
	err := world.router.UnMarshal(data, msgRecv)
	if err != nil {
		logger.Errorf("recv data:%v msg:%v", data, msgRecv)
		return
	}
	world.addPlayerChan <- msgRecv
}

func (world *World) playerLeavePvpSeverHandler(msgId uint16, data []byte) {
	msgRecv := &command.PlayerLeavePvpServer{}
	err := world.router.UnMarshal(data, msgRecv)
	if err != nil {
		logger.Errorf("recv data:%v msg:%v", data, msgRecv)
		return
	}
	world.chanPlayerOffline <- msgRecv.PlayerId
}
